<%@ include file="base.jsp" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<%@ page import="net.amsoft.iservice.ilink.webapp.struts.form.ConfigForm"%>
<%@ page import="net.amsoft.iservice.ilink.webapp.dataObject.IBrokerData" %>
<%@ page import="net.amsoft.iservice.ilink.util.ILinkConstants" %>
<%@ page import="net.amsoft.iservice.ilink.hibernate.IBroker" %>
<%@ page import="net.amsoft.iservice.ilink.webapp.dataObject.LoginData" %>
<%@ page import="net.amsoft.iservice.ilink.service.ILinkService" %>

<html>
<head>
<script src="javascripts/help.js"></script>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title><bean:message key="title.configure" /></title>
<link rel="stylesheet" type="text/css" href="styleSheets/iservices.css" />
<%
	ConfigForm configForm = (ConfigForm)request.getAttribute("configData");
	String[] arPersonalDict = (String[]) configForm.getDictionaryPersonal();
	String[] arBusinessDict = (String[]) configForm.getDictionaryBusiness();
	String[] arCommunityDict = (String[]) configForm.getDictionaryCommunity();
	
	StringBuffer sPersonalDict = new StringBuffer(); 
	StringBuffer sBusinessDict = new StringBuffer(); 
	StringBuffer sCommunityDict = new StringBuffer(); 
	
	for(int i = 0; i < arPersonalDict.length; i++)
	{
		if(i != 0)	sPersonalDict.append(',') ;
		sPersonalDict.append(arPersonalDict[i]);
	}
	
	for(int i = 0; i < arBusinessDict.length; i++)
	{
		if(i != 0)	sBusinessDict.append(',') ;
		sBusinessDict.append(arBusinessDict[i]);
	}
	
	for(int i = 0; i < arCommunityDict.length; i++)
	{
		if(i != 0)	sCommunityDict.append(',') ;
		sCommunityDict.append(arCommunityDict[i]);
	}
	
	// Service URLs
	String issoURL = "#";
	String contactURL = "#";
	
	// Get IBroker Data
	IBroker oIBroker = ILinkService.getIBroker(request.getServerName());
		
	// Get loggedInSynonym
	LoginData oLoginData = (LoginData) session.getAttribute(ILinkConstants.SESSION_LOGIN_OBJ);
	if ((oIBroker!=null) && (oLoginData!=null))
	{
		issoURL = oIBroker.getIssoURL() + oLoginData.getLoggedInSynonym();
		contactURL = oIBroker.getContactURL() + oLoginData.getLoggedInSynonym();
	}

%>
<script language="javascript" src="javascripts/ilink.js"></script>

</head>
<body onload="resizeIframe();">
		
<center>

<FORM name="configure">
<table cellspacing=25 border=0 cellpadding=0 width="800">
	<tr>
	<td height=120><img src="<%=imagePath%>/ibroker-logo.gif" height=120 width=121 /></td>
	<td height=120 width=605>
		<a class="link-nounderline" href="<%=((IBrokerData)session.getAttribute(ILinkConstants.SESSION_IBROKER_OBJ)).getBannerLink()%>" > 
			<img border="0" src="<%=imagePath%>/ad-banner.gif" height=120 width=605  /> 
		</a>
	</td>
	</tr>

	<tr>
        <td colspan="2" width="780" valign="top">
			<center>
			<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<tr><td align="left" colspan="3" height="25px" width="300" valign="bottom"><a href="<%=issoURL%>"><img src="<%=imagePath%>/tab-noclick-isso.jpg" border="0" onmouseover="this.src='<%=imagePath%>/tab-rollover-isso.jpg'" onmouseout="this.src='<%=imagePath%>/tab-noclick-isso.jpg'" /></a><a href="<%=contactURL%>"><img src="<%=imagePath%>/tab-noclick-contact.jpg" border="0" onmouseover="this.src='<%=imagePath%>/tab-rollover-contact.jpg'" onmouseout="this.src='<%=imagePath%>/tab-noclick-contact.jpg'" /></a><img src="<%=imagePath%>/tab-click-forwarding.jpg" border="0" onmouseover="this.src='<%=imagePath%>/tab-rollover-forwarding.jpg'" onmouseout="this.src='<%=imagePath%>/tab-click-forwarding.jpg'" /></td></tr>
				<tr>
					<td>
					<table border="0" cellpadding="0" cellspacing="0" width="760px">
						<tr height="10">
							<td width="10" bgcolor="#999999"><img src="<%=imagePath%>/grey-square.gif"></td>
							<td width="740" bgcolor="#999999" valign="top">
								<table>
									<tr height="45">
										<td width="600" bgcolor="#999999" valign="middle" align="left">
											<img src="<%=imagePath%>/title_forwarding_configure.gif" />
										</td>
										<td width="140" bgcolor="#999999" valign="middle">
											<html:link action="/Logout" titleKey="msg.logout"> 
												<img src="<%=imagePath%>/button-logout.jpg" border="0" align="right" />
											</html:link>
										</td>
									</tr>
								</table>
							</td>
							<td width="10" bgcolor="#999999"><img src="<%=imagePath%>/grey-square.gif"></td>
						</tr>						
						<tr>
							<td width="10" bgcolor="#999999"><img src="<%=imagePath%>/grey-square.gif"></td>
							<td width="740" >
							<table width="740" border="0" bgcolor="#CCCCCC">
								
								<tr>
									<td colspan="4">&nbsp;</td>
								</tr>
								<tr>
									<td class="black-headertext"><bean:message key="label.current.dictionary"/></td>
									<td id='tagElement'>
										<SELECT NAME="dictionary" onchange="loadTags();" class="black-smalltext" style="height:17px;width:210px">
											<option class="textbox" value="1" selected="selected" class="black-smalltext"><bean:message key="option.dictionary.personal"/></option>						
											<option class="textbox" value="2" class="black-smalltext"><bean:message key="option.dictionary.business"/></option>
											<option class="textbox" value="3" class="black-smalltext"><bean:message key="option.dictionary.community"/></option>
											<option class="textbox" value="0" class="black-smalltext"><bean:message key="create.own.tag"/></option>						
										</SELECT>
									</td> 
									<td colspan="2" class="black-smalltext"><bean:message key="label.instruction"/><font class="blue-smalltext"><bean:message key="label.learn.more"/></font>.
									<a class="link-nounderline" class="cursor:pointer" onmouseover="showHelp('<bean:message key='label.help.dictionarytitle'/>', '<bean:message key='label.help.dictionarymsg' />');"><img border="0" src="<%=imagePath%>/help-bullet.jpg"/>	</a>
									</td>					
								</tr>
				
								<tr colspan="4" height="5px"><td/></tr>
				
								<tr>
									<td colspan="4" class="black-smalltext"><bean:message key="label.steps"/> <font class="blue-smalltext"><bean:message key="label.learn.more"/></font>.
									<a class="link-nounderline" class="cursor:pointer" onmouseover="showHelp('<bean:message key='label.help.customtagtitle'/>', '<bean:message key='label.help.customtagmsg' />');"><img border="0" src="<%=imagePath%>/help-bullet.jpg"/>	</a>
									</td>					
								</tr>
				
								<tr colspan="4" height="5px"><td/></tr>
				
								<tr> 
									<td class="black-headertext"><bean:message key="label.head.iname"/></td>
									<td class="black-headertext"><bean:message key="label.head.tag"/></td>
									<td class="black-headertext"><bean:message key="label.head.forward"/></td>
									<td class="black-headertext"><bean:message key="label.head.access"/></td>									
								</tr>
				
								<tr>
									<td> 
										<bean:define id="synonyms" name="configData" property="synonyms"/>
										<SELECT NAME="iname" class="black-smalltext" class="black-smalltext" style="height:17px;width:150px">
											<option class="textbox" value="default" class="black-smalltext"><bean:message key="option.iname.default"/></option>
											<logic:iterate id="iname" name="synonyms">
												<option value="<bean:write name="iname"/>" class="black-smalltext"><bean:write name="iname"/></option>
											</logic:iterate>
										</SELECT>
									</td>
									<td>
										<bean:define id="tagList" name="configData" property="dictionaryPersonal"/>
										<SELECT NAME="tags" id="cbox" class="black-smalltext" style="height:17px;width:100px">
											<logic:iterate id="tag" name="tagList">
												<option value="<bean:write name="tag"/>" class="black-smalltext"><bean:write name="tag"/></option>
											</logic:iterate>
										</SELECT>
										<INPUT TYPE="text" name='TagTextBox' size="22" maxlength="255" id="tbox" style="display: none;" class="textbox">
									</td>
									<td><INPUT TYPE="text" name='ForwardsTo' size="32" maxlength="255" value="http://" class="textbox">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									</td>	
									<td>
										<SELECT NAME="ispublic" id="cbox_ispublic" class="black-smalltext" style="height:17px;width:100px">
											<option value="Public" class="black-smalltext"><bean:message key="label.tag.public"/></option>
											<option value="Private" class="black-smalltext"><bean:message key="label.tag.private"/></option>											
										</SELECT>
									</td>
								</tr>
				
								<tr colspan="4" height="5px"><td/></tr>
				
								<tr>
									<td colspan="3" align="right">
										<a style="cursor:pointer;">
										<img src="<%=imagePath%>/button-submit.jpg" border="0" onclick="selectOp()";/></a>
										&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
										<a href="/ilink/CheckLogin">
										<img src="<%=imagePath%>/button-cancel.jpg" border="0"/></a>										
									</td>
									<td>&nbsp;</td>
								</tr>

								<tr>
									<td colspan="4"><img height="2px" width="100%" src="<%=imagePath%>/dotted-line.gif" /></td>
								</tr>
				
								<tr height="25">
									<td class="black-headertext"><bean:message key="label.standard.links"/></td>
									<td colspan="3" class="black-smalltext"><bean:message key="label.standardLink.desc"/>
									<font class="blue-smalltext"><bean:message key="label.learn.more"/></font>.
									<a class="link-nounderline" class="cursor:pointer" onmouseover="showHelp('<bean:message key='label.help.standardlinktitle'/>', '<bean:message key='label.help.standardlinkmsg' />');"><img border="0" src="<%=imagePath%>/help-bullet.jpg"/>	</a>
									</td>
								</tr>
				
								<tr height="5px"><td/></tr>
								
								<tr>
									<td colspan="4">
										<table border="0" width="100%" >
										<bean:define id="synonyms" name="configData" property="synonyms"/>						
										<logic:iterate id="iname" name="synonyms">
											<tr>
												<td class="black-smalltext">
													<a href='<bean:message key="xri.net.url"/>/<bean:write name="iname"/>' class="link-nounderline"><bean:message key="xri.net.url"/>/<bean:write name="iname"/></a>
												</td>
												<td class="black-smalltext"><bean:message key="label.link.desc"/> '<bean:write name="iname"/>'
												</td>				
											</tr>
											
											<tr>
												<td class="black-smalltext">
													<a href='<bean:message key="xri.net.url"/>/<bean:write name="iname"/>/(<bean:message key="tag.contact"/>)' class="link-nounderline"><bean:message key="xri.net.url"/>/<bean:write name="iname"/>/(<bean:message key="tag.contact"/>)</a>
												</td>
												<td class="black-smalltext"><bean:message key="label.link.desc"/> '<bean:write name="iname"/>'
												</td>				
											</tr>
										</logic:iterate>
											
										</table>
									</td>
								</tr>

								<tr>
									<td colspan="4"><img height="2px" width="100%" src="<%=imagePath%>/dotted-line.gif" /></td>
								</tr>
				
								<tr>
									<td class="black-headertext"><bean:message key="label.custom.links"/></td>
									<td colspan="3" class="black-smalltext"><bean:message key="label.customLink.desc"/>
									<font class="blue-smalltext"><bean:message key="label.learn.more"/></font>.
									<a class="link-nounderline" class="cursor:pointer" onmouseover="showHelp('<bean:message key='label.help.customlinktitle'/>', '<bean:message key='label.help.customlinkmsg' />');"><img border="0" src="<%=imagePath%>/help-bullet.jpg"/>	</a>
									</td>
								</tr>
				
								<tr colspan="4" height="5px"><td/></tr>
				
								<tr>
									<td colspan="4">
										<IFRAME id="ifrLinks"  name="ifrLinks" frameborder="0" src="/ilink/PreConfig?scope=ilinks" height="150" width="700" ></IFRAME>
									</td>
								</tr>

								<tr colspan="4" height="5px"><td/></tr>
							</table>
							</td>
							<td width="10" bgcolor="#999999"><img src="<%=imagePath%>/grey-square.gif"></td>
						</tr>
						<tr height="10">
							<td width="10" bgcolor="#999999"><img src="<%=imagePath%>/grey-square.gif"></td>
							<td width="680" bgcolor="#999999"></td>
							<td width="10" bgcolor="#999999"><img src="<%=imagePath%>/grey-square.gif"></td>
						</tr>						
					</table>
					</td>
				</tr>
			</table>
			</center>	
		</td>        
    </tr>	
</table>
</FORM>

<FORM name="frmData">
<INPUT type="hidden" name="personalDict" value="<%=sPersonalDict%>">
<INPUT type="hidden" name="businessDict" value="<%=sBusinessDict%>">
<INPUT type="hidden" name="communityDict" value="<%=sCommunityDict%>">
<INPUT type="hidden" name="opType" value='1'>

</FORM>
<TABLE>
	<TR>
		<TD><IFRAME name="ifrDelete" src="/ilink/Prepare" height="0" width="0" ></IFRAME></TD>
		<TD><IFRAME name="ifrEdit" src="/ilink/Prepare" height="0" width="0" ></IFRAME></TD>
		<TD><IFRAME name="ifrCreate" src="/ilink/Prepare" height="0" width="0" ></IFRAME></TD>
	</TR>
</TABLE>

</center>
<form name="helpForm">
	<input name='imagePath' type='hidden' value='<%=imagePath%>' />
	<DIV id="help" class="helpbox"></DIV>
</form>

<FORM name="messages">
	<INPUT type="hidden" name="tag_empty" value='<bean:message key="alert.tag.empty"/>'>
	<INPUT type="hidden" name="tag_spaces" value='<bean:message key="alert.tag.spaces"/>'>
	<INPUT type="hidden" name="contact_standard" value='<bean:message key="alert.contact.standard"/>'>
	<INPUT type="hidden" name="fwd_empty" value='<bean:message key="alert.forwardto.empty"/>'>
	<INPUT type="hidden" name="del_ilink" value='<bean:message key="alert.delete.ilink"/>'>		
</FORM>
		
</body>
</html>